//
//  RYYQueRenToolView.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2021/1/13.
//  Copyright © 2021 叁拾叁. All rights reserved.
//


import UIKit
import YYText

class RYYQueRenToolView: SYBaseView {
    
    let alert = RYPaySuccessAlert()
    let titleLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 14.autoFontSize()
        v.text = "支付金额："
        
        return v
    }()
    
    let price: YYLabel = {
        let v:YYLabel = YYLabel()
        v.textColor = UIColor(hex: 0xF55035)
        v.font = 16.autoFontSize()
        
        return v
    }()
   

    let renyang: UIButton = {
        let v: UIButton  = UIButton()
        v.setImage(UIImage(named: "lijizhifu"), for: .normal)
        return v
    }()
    
    func configure(_ priceStr: String) {
        price.attributedText =  self.setPriceLb(priceStr)
    }
    
    override func initViews() {
        
        renyang.addAction {[weak self] in
            if let `self` = self {
                let currentvc = (self.currentVC as! RYQuerenDIngdanViewController)
                currentvc.getBuy()
            }
        }
        
        self.backgroundColor = .white
        addSubview(titleLb)
        addSubview(price)
        addSubview(renyang)
        titleLb.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15.autoWidth())
            make.height.equalTo(40.autoWidth())
        }
        price.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(80.autoWidth())
            make.height.equalTo(40.autoWidth())
        }
        renyang.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-16.autoWidth())
            make.height.equalTo(36.autoWidth())
            make.width.equalTo(150.autoWidth())
        }
    }

    func setAlert() {
        
        let window = UIApplication.shared.keyWindow
        window?.addSubview(alert)
        alert.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
}
